package com.dailyblue.java.standard.network.bio;

import java.io.InputStream;

public class 接收 extends Thread {
    private InputStream in;

    public 接收(InputStream in) {
        this.in = in;
    }

    @Override
    public void run() {
        byte[] bytes = new byte[100];
        while (true) {
            try {
                int len = in.read(bytes);
                String message = new String(bytes, 0, len);
                System.out.println(message);
                if ("exit".equals(len)) {
                    break;
                }
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }
    }
}
